<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>平均工资</title>
</head>
<body>

</body>
<script>
    var employees =[
      {
        id:1,
        gender:'male',
        name:'L',
        salary:7200
      }, {
        id:2,
        gender:'male',
        name:'M',
        salary:8600
      } ,{
        id:3,
        gender:'female',
        name:'N',
        salary:10900
      }
    ]


  var total=  employees.reduce(function (result,curr){
         return result+curr.salary;
    },0)


 var avg= total/employees.length;


var men= employees.filter(function (emp){
    return emp.gender == 'male';
})

    var women= employees.filter(function (emp){
        return emp.gender == 'female';
    })




</script>
</html>